home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Gamer Resource Kit / Hardcore Gamer Resource Kit - Disc 2.iso / Utils / UNIX / UNZIP520 / MSDOS / MAKEFILE.DJ2 < prev    next >
Text File  |  1996-04-25  |  5KB  |  181 lines

  1. # Makefile for Info-ZIP's UnZip, UnZipSFX and fUnZip using djgpp v2.0, by
  2. # Frank Donahoe.  Tested with UnZip 5.20p beta by Christian Spieler.
  3. # Last updated:  25 Apr 96
  4. #
  5. # This Makefile is specifically tailored for GNU make and GNU C and
  6. # may not work with a generic Unix-compatible make utility.
  7. # Features used:
  8. # - pattern rules (%.o : %.c, etc.)
  9. # - GNU-specific conditionals and functions  (ifeq, $(patsubst,,),...)
  10. #
  11. # The stand-alone executable requires DPMI services to run.  If running
  12. # in a DOS window under Windows 3.1 or later, the dpmi server is auto-
  13. # matically present.  Under DOS, if a DPMI server is not loaded, the
  14. # program will look for "cwsdpmi.exe."  If found, it will be loaded for
  15. # the duration of the program.
  16. #
  17. # cwsdpmi is a "free" dpmi server written by Charles W. Sandmann
  18. # (sandman@clio.rice.edu).  It may be found, among other sites, on SimTel
  19. # and its mirrors in the .../vendors/djgpp/v2misc directory.
  20.  
  21. # Separators colon and <sp> are used in U**X, semi-colon and <sp> in DOS.
  22. VPATH=. msdos
  23.  
  24. ifdef NOASM
  25. USE_ASMCRC=
  26. else
  27. USE_ASMCRC=1
  28. endif
  29.  
  30. # UnZip flags
  31. # LOCAL_UNZIP may be set in AUTOEXEC.BAT or defined in djgpp.env [make].
  32. # See, for example, DOSWILD, in the file INSTALL.
  33.  
  34. # [make]
  35. # LOCAL_UNZIP=-DDOSWILD
  36. # BUTT=-m486
  37.  
  38. # BUTT may also be defined to specify the target system.  At present, -m386
  39. # and -m486 are the only supported options.  Either will produce code which
  40. # will run on the other microprocessor, though possibly not so fast.
  41.  
  42. LOC=-DDOS $(ASMFLG) $(LOCAL_UNZIP)
  43. CC=gcc
  44. LD=$(CC)
  45. CPPFLAGS=-I. $(LOC)
  46. ASFLAGS=$(CPPFLAGS)
  47. CFLAGS=-Wall -O2 $(BUTT) $(CPPFLAGS)
  48. FUN_FLAGS=$(CFLAGS) -DFUNZIP
  49. SFX_FLAGS=$(CFLAGS) -DSFX
  50. LDFLAGS=-s
  51.  
  52. # general-purpose stuff
  53. # If cp.exe is not found change to CP=copy /Y    .
  54. CP = cp -f
  55. # If install.exe is not found change to INSTALL=$(CP)   .
  56. INSTALL=install
  57. # The default value of RM is "rm -f"  .  If rm.exe is not found, uncomment
  58. # the following:
  59. # RM=del
  60. E = .exe
  61. O = .o
  62. M=msdos
  63.  
  64. # defaults for crc32 stuff and system dependent headers
  65. ifdef USE_ASMCRC
  66. ASMFLG = -DASM_CRC
  67. CRC32 = crc_gcc
  68. else
  69. ASMFLG =
  70. CRC32 = crc32
  71. endif
  72.  
  73. # object files
  74. OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
  75. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  76. OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
  77. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  78.  
  79. OBJX = unzipsfx$O $(CRC32)$O crctab$O crypt$O extract_$O fileio$O globals$O \
  80.     inflate$O match$O process_$O ttyio$O $M_$O
  81.  
  82. OBJF = funzip$O $(CRC32)$O crypt-$O globals-$O inflate-$O ttyio-$O
  83.  
  84. OBJECTS_ALL = $(sort $(OBJS) $(OBJX) $(OBJF) crc32$O crc_gcc$O)
  85.  
  86. # Common header files included by all C sources:
  87. UNZIP_H = unzip.h unzpriv.h globals.h msdos/doscfg.h
  88.  
  89. # executable files
  90. UNZIPS = unzip$E zipinfo$E funzip$E unzipsfx$E
  91.  
  92. # pattern rules to compile the sources:
  93. %$O : %.c
  94.     $(CC) $(CFLAGS) -c $< -o $@
  95.  
  96. %-$O: %.c
  97.     $(CC) $(FUN_FLAGS) -c $< -o $@
  98.  
  99. %_$O: %.c
  100.     $(CC) $(SFX_FLAGS) -c $< -o $@
  101.  
  102. %sfx$O: %.c
  103.     $(CC) $(SFX_FLAGS) -c $< -o $@
  104.  
  105. all: unzips
  106.  
  107. unzips:    unzip$E zipinfo$E funzip$E unzipsfx$E
  108.  
  109. unzip$E: $(OBJS)
  110.     $(LD) $(LDFLAGS) $(OBJS) -o $@
  111.  
  112. zipinfo$E: unzip$E
  113.     stubify -g $@
  114.     stubedit $@ runfile=unzip argv0=zipinfo
  115.  
  116. funzip$E: $(OBJF)
  117.     $(LD) $(LDFLAGS) $(OBJF) -o $@
  118.  
  119. unzipsfx$E: $(OBJX)
  120.     $(LD) $(LDFLAGS) $(OBJX) -o $@
  121.  
  122. # explicit compilation instructions:
  123.  
  124. crc_gcc$O: crc_i386.S        # 32bit, GNU AS
  125.     $(CC) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S
  126.  
  127. # BIN_PATH may be defined in djgpp.env [make] or defined below.  If the
  128. # installation is to the directory containing gcc.exe etc. place the
  129. # following in djgpp.env:
  130.  
  131. # [make]
  132. # BIN_PATH=%\>;BIN_PATH%%\DJDIR%\bin
  133.  
  134. # Even if so placed, it can be over-ridden here by, say:
  135. # BIN_PATH=c:\usr\bin
  136.  
  137. install:  $(UNZIPS)
  138.     -@if not exist $(BIN_PATH)\nul mkdir $(BIN_PATH)
  139.     for %%f in ($(UNZIPS)) do $(INSTALL) %%f $(BIN_PATH)
  140.  
  141. uninstall:
  142.     for %%f in ($(UNZIPS)) do $(RM) $(BIN_PATH)\%%f
  143.  
  144. clean:
  145. ifeq ($(firstword $(RM)), del)
  146.     $(RM) *$O
  147.     $(RM) *.exe
  148. else
  149.     $(RM) $(OBJECTS_ALL) *.exe
  150. endif
  151.  
  152. # Source dependencies:
  153. crc_gcc$O:      crc_i386.S
  154. crc32$O:        crc32.c $(UNZIP_H) zip.h
  155. crctab$O:       crctab.c $(UNZIP_H) zip.h
  156. crypt$O:        crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  157. crypt-$O:       crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  158. envargs$O:      envargs.c $(UNZIP_H)
  159. explode$O:      explode.c $(UNZIP_H)
  160. extract$O:      extract.c $(UNZIP_H) crypt.h
  161. extract_$O:     extract.c $(UNZIP_H) crypt.h
  162. fileio$O:       fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  163. funzip$O:       funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  164. globals$O:      globals.c $(UNZIP_H)
  165. globals-$O:     globals.c $(UNZIP_H)
  166. inflate$O:      inflate.c inflate.h $(UNZIP_H)
  167. inflate-$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
  168. list$O:         list.c $(UNZIP_H)
  169. match$O:        match.c $(UNZIP_H)
  170. msdos$O:        msdos/msdos.c $(UNZIP_H)
  171. msdos_$O:       msdos/msdos.c $(UNZIP_H)
  172. process$O:      process.c $(UNZIP_H)
  173. process_$O:     process.c $(UNZIP_H)
  174. ttyio$O:        ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  175. ttyio-$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  176. unreduce$O:     unreduce.c $(UNZIP_H)
  177. unshrink$O:     unshrink.c $(UNZIP_H)
  178. unzip$O:        unzip.c $(UNZIP_H) crypt.h version.h consts.h
  179. unzipsfx$O:     unzip.c $(UNZIP_H) crypt.h version.h consts.h
  180. zipinfo$O:      zipinfo.c $(UNZIP_H)
  181.